package com.example.helloworld;

/**
 * ClassName: ArrayTypeParam
 * Package: com.example.helloworld
 * Description:
 *
 * @Author guotingting
 * @Create 2025/4/23 10:35 AM
 * @Version 1.0
 */
public class ArrayTypeParam {
    public void sort(int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
    }

    // 打印数组
    public void printArray(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) {
        ArrayTypeParam obj = new ArrayTypeParam();
        int[] arr = {64, 34, 25, 12, 22, 11, 90};
        System.out.println("Original Array:");
        obj.printArray(arr);
        System.out.println("Sorted Array:");
        obj.sort(arr);
        obj.printArray(arr);
    }
}


